<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../vue文件/vue.js"></script>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for='(item,index) in stu' :key='item.id'>
                姓名：{{item.name}} 年龄：{{item.age}}
                <button @click='del(index)'>✖</button>
            </li>
            

        </ul>
    </div>
</body>
<script>
    let vm = new Vue ({
        el:'#app',
        data:{
            stu:[
                {id:'1',name:'小明',age:'18'},
                {id:'2',name:'小红',age:'30'},
                {id:'3',name:'小李',age:'22'},
                {id:'4',name:'小亮',age:'25'},
                {id:'5',name:'小吕',age:'28'}

            ]
        },
        methods:{
            del(index){
                this.stu.splice(index,1);
            }
        }
    })
</script>
</html>